// page/mine/address.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  onShow: function () {
  },
  onLoad: function (options) {
    var that = this;
    wx.getSetting({
      success(res) {
        if (!res.authSetting['scope.address']) {
          wx.authorize({
            scope: 'scope.address',
            success(e) {
              that.getAddress();
            }
          })
        } else {
          that.getAddress();
        }
      }
    })
  },
  getAddress: function(){
    wx.chooseAddress({
      success: function (res) {
        console.log(res.userName)
        console.log(res.postalCode)
        console.log(res.provinceName)
        console.log(res.cityName)
        console.log(res.countyName)
        console.log(res.detailInfo)
        console.log(res.nationalCode)
        console.log(res.telNumber)
      }
    })
  },
  onShareAppMessage: function () {

  }
})